from extremeKanban.kanban.exception import UnknownMethodException
from extremeKanban.kanban.models import Story

class KanbanServer(object):
	def publish(self, service):
		self.service = service
		self.methods = [method for method in dir(self.service) if not method.startswith("_")]

	def invoke(self, method, *args):
		if method not in self.methods:
			raise UnknownMethodException(method)
		return getattr(self.service, method)(*args)

class KanbanService(object):
	def create_story(self):
		story = Story()
		story.save()
		return story.id
